{extend name="public/layout" /}
{block name="head"}
<style>
  .tab-content{padding:0!important;}
</style>
{/block}
{block name="body"}
<body>
<div class="container-fluid p-t-15">
  <div class="card">
    <div class="tab-content">
      <div class="tab-pane active">
        <div class="card-header card-header-sm">
          <form id="search-form" class="form-inline">
              <div class="form-group">
                <select class="form-control" name="search_field">
                  <option value="name">姓名</option>
                  <option value="mobile">手机号</option>
                </select>
              </div>
              <div class="form-group">
                <input type="text" class="form-control" name="search_value" />
              </div>
            <button type="button" onclick="helper.refreshTable()" id="search-btn" class="btn btn-default">
              <i class="mdi mdi-magnify"></i> 搜索
            </button>
          </form>
        </div>
        <div class="card-body p-lr-15">
          <div class="table-responsive">
            <table id="grid" class="table"></table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
  helper.bootstrapTable({
    url: 'index.html',
    columns: [
      {field: "checkbox", checkbox: true},
      {field: "id", title: "#", width: 50, sortable: true},
      {field: "name", title: "名称", width:50},
      {field: "mobile", width: 100, title: "手机号"},
      {field: "content", width: 100, title: "留言内容"},
      {field: "create_time", width: 100, title: "提交时间"},
      {field: "reply", title: "处理信息", width:180,formatter:function (value, row, index) {
          if (row.reply==''){
            return '暂未处理';
          }else {
            return value;
          }
        }},
      {field: "update_time", title: "处理时间", width:180,formatter:function (value, row, index) {
          if (row.reply==''){
            return '';
          }else {
            return value;
          }
        }},
      {
        field: "operate", title: "操作", width: "160",
        formatter: function (value, row, index) {
          var html = '';
          html += '<a href="javascript:void(0);"  class="btn-xs btn btn-primary" onclick="doAction.edit(' + row.id + ')">' +
                  '<i class="mdi mdi-pencil"></i> 处理</a> ';
          html += '<a href="javascript:void(0)" class="btn-xs btn btn-danger" onclick="helper.doConfirm(this)"' +
              ' data-url="del.html" data-params="id=' + row.id + '" ' +
              'data-msg="确认删除吗?"><i class="mdi mdi-archive"></i> 删除</a>';
          return html;
        }
      },
    ]
  });
  var doAction = {
    edit: function (id) {
      helper.createTab({
        title: '回复信息',
        url: '/system/message/edit.html?id=' + id
      });
    }
  };
</script>
</body>
{/block}